package polytech.simulation;

import java.util.ArrayList;
import polytech.simulation.core.TreePopulator;
import polytech.simulation.storage.ProblemDescription;
import polytech.simulation.storage.Tree;

/**
 * Classe maitresse de l'application
 * @author Amirouche
 */
public class Application {
	public static void main(String[] args){
		
		ProblemDescription problem = new ProblemDescription();
		
		double[] forwardPrice = {
			2.36,
			2.45,
			2.58,
			2.59
		};
		
		double[] seasonalityFactor = {
			0.96,
			1.02,
			1.09,
			1.11
		};
		
		problem.setDeltaT(1./12.);
		problem.setKappa(3.0);
		problem.setT(4);
		problem.setSigmaX(.6);
		problem.setDzeta(0.8);
		problem.setForwardPrice(forwardPrice);
		problem.setSeasonalityFactor(seasonalityFactor);
		
		Tree tree = TreePopulator.createTree(problem);
		TreePopulator.populateTree(tree, problem);
		TreePopulator.computeA(tree, problem);
		TreePopulator.computeDeseasonlizedSpotPrice(tree, problem);
		
		int i = 0;
		for(double ai : problem.getA()){
			System.err.println("a" + i + " = " + ai);
			i++;
		}
		
		System.out.println("D(3,1) = " + tree.getNode(3, 1).getValue(TreePopulator.D_VALUE));
		
	}
}
